Skip to content

Transport: normalize CR/LF/CRLF and return single-line decoded identify; add robust monitoring#2

Merged
MarkoVcode merged 15 commits into
mainfrom
project_layout
Oct 1, 2025
Merged

Transport: normalize CR/LF/CRLF and return single-line decoded identify; add robust monitoring#2
MarkoVcode merged 15 commits into
mainfrom
project_layout

Conversation

@MarkoVcode

Copy link
Copy Markdown
Owner

Summary

  • Centralize decoding and EOL normalization in SerialTransport.read_until_reol so identify() returns a clean single-line string
  • Normalize CR/LF/CRLF handling. When a read EOL (reol) is configured, skip leading EOL noise and read strictly until the configured EOL
  • Keep existing write behavior; when seol is empty, do not append a terminator

Monitoring improvements (prev commits on this branch)

  • SerialManager: periodic 15s identify health probe; consider link healthy only when identify returns a value; mark disconnected otherwise
  • Reconnect backoff every 2s when disconnected or port closed
  • Fallback to first model in manifest when model not provided, for connection settings

Tests

  • Updated/added tests to mock pyserial and validate:
    • Driver identify returns str (no manual decode required)
    • Config YAML -> manifest -> transport -> identify flow
    • Serial kwargs compatibility (xonxoff/rtscts/dsrdtr)
    • SerialManager monitoring and reconnect logic

Why

  • Some instruments send responses with different line endings ("\n" vs "\r\n"). Returning a unified single line prevents downstream parsing issues and intermittent empty reads.

Notes

  • No changes to public API beyond identify() returning str (vs bytes) from drivers that use transport.read_until_reol.
  • Logging remains via benchmesh_service logger; DEBUG to file, INFO to console by default.

Co-authored-by: openhands openhands@all-hands.dev

openhands-agent and others added 15 commits September 29, 2025 22:00
chore(tests): add pytest suite mocking pyserial to verify SerialManager instantiates connections for all devices and probes without real hardware; cover failure tolerance and reconnect logic

fix: clean serial_manager imports (use relative logger import)\n\nCo-authored-by: openhands <openhands@all-hands.dev>
…ke establish_connections use per-device reconnect

test: add backoff/reopen test and relax failing-open assertion; switch requirements.txt to pyserial to match pyproject

Co-authored-by: openhands <openhands@all-hands.dev>
…h-serial-service\n\nCo-authored-by: openhands <openhands@all-hands.dev>
…nd instantiate drivers via dynamic import; add shared SerialTransport and identify() in drivers; update tests to mock transport serial\n\nCo-authored-by: openhands <openhands@all-hands.dev>
…oid repeated log lines\n\nCo-authored-by: openhands <openhands@all-hands.dev>
Refactor SerialManager to dynamic drivers + transport; add identify() and fix logger duplication
…fix manifest loading; support nested driver imports and tenma alias; adjust package imports

Co-authored-by: openhands <openhands@all-hands.dev>
…kage; update dynamic loader and tests

Co-authored-by: openhands <openhands@all-hands.dev>
…sconnected on no/failed response; reconnect every 2s

Also fix manifest model selection fallback when model not provided.

Co-authored-by: openhands <openhands@all-hands.dev>
…o str

- Centralize decoding and EOL stripping in SerialTransport.read_until_reol
- Update tests to accept extra Serial kwargs and to expect str identify()
- Remove stray print in check_status; maintain reconnection semantics

Co-authored-by: openhands <openhands@all-hands.dev>
…ndle CR, LF, CRLF consistently

Co-authored-by: openhands <openhands@all-hands.dev>
… until configured EOL only

Co-authored-by: openhands <openhands@all-hands.dev>
@MarkoVcode MarkoVcode marked this pull request as ready for review October 1, 2025 09:33
@MarkoVcode MarkoVcode merged commit 377e853 into main Oct 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants